package com.my.java.algorithm.sort;

public class InsertSort {
        public static void insertSort() {
                int a[] = { 49, 38, 65, 97, 76, 13, 27, 49, 78, 34, 12, 64, 5, 4, 62, 99, 98, 54, 56, 17, 18, 23, 34, 15, 35, 25, 53, 51 };
                int temp = 0;
                for (int i = 1; i < a.length; i++) {
                        int j = i - 1;
                        temp = a[i];
                        for (; j >= 0 && temp < a[j]; j--) {
                                a[j + 1] = a[j]; // 将大于temp的值整体后移一个单位
                        }
                        a[j + 1] = temp;
                        for (int c = 0; c < a.length; c++)
                                System.out.print(a[c]+",");
                        System.out.println();
                }
        }
        
        public static void main(String[] args) {
              assert 1 > 0;
              System.out.println("aaa");
        }
}